<template>
<div>

    <div><h1>添加客户</h1></div>
    <div v-width="400" class="addt">
        <br>
        <div>
            客户名称&nbsp;&nbsp;<input type="text" v-model="name">
        </div>

        <div>
            公司地址&nbsp;&nbsp;<input type="text" v-model="site">
        </div>
        <div>
            联系人姓名&nbsp;&nbsp;<input type="text" v-model="username">
        </div>
        <div>
            联系人电话&nbsp;&nbsp;<input type="text" v-model="phone">
        </div>
        <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <Button color="primary"  @click="submit">确认添加</Button>
  </div>
</div>
</template>

<style>
    .addt {
    background-color: rgb(219, 221, 224);
    line-height: 60px;
    border-radius: 10px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%,-50%);
  }
</style>

<script>
import { addclient_post } from './axios_api/api';
export default {
  data() {
    return {
        name:"",
        site:"",
        username:"",
        phone:""
    };
  },
  mounted(){
     
  },
  methods: {
      submit(){
          var type = localStorage.getItem('type')
          var data = {name:this.name,site:this.site,username:this.username,phone:this.phone}
          if(type==5){
              addclient_post(data).then(resp=>{
                this.$Message(resp.message)
            })
          }else{
              this.$Message("权限不足")
          }
      },

  }
};
</script>
